package com.im.app.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.im.app.model.Personhost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface IPersonhostMapper extends BaseMapper<Personhost> {

    @Select("select * from personhost where user_id = #{userId} and leixing=#{type} and group_id is null limit 1")
    Personhost getPersonhostByUserIdAndType(@Param("userId")String userId,@Param("type")Integer type);

    @Select("select * from personhost where group_id = #{groupId} and leixing=#{type} and status=2")
    Personhost getPersonhostByGroupIdAndType(@Param("groupId")String groupId,@Param("type")Integer type);

    @Select("select * from personhost where user_id = #{userId} and (leixing = 1 or leixing = 3 or leixing = 9) order by leixing asc")
    List<Personhost> getAll(@Param("userId")String userId);

}
